<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="${css}/pintuer.css">
    <link rel="stylesheet" href="${css}/admin.css">
    <link rel="stylesheet" href="${css}/bootstrap.css">
    <script src="${js}/jquery.js"></script>
    <script src="${js}/pintuer.js"></script>
    <script src="${js}/bootstrap.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>修改书本信息</strong></div>
    <div class="body-content">
        <form method="post" class="form-x" action="${root}/book/update"  enctype="multipart/form-data">
            <input type="hidden" name="bid" value="${update.bid}" />
            <input type="hidden" value="${update.stated}" name="stated" />
            <div class="form-group">
                <div class="label">
                    <label>书名：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50"  name="title" value="${update.title}" data-validate="required:请输入新书名称" />
                    <div class="tips"></div>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label>类型：</label>
                </div>
                <div class="field">
                    <select name="cid" class="input w50">
                        <option  <c:if test="${update.cid==0}">selected</c:if>  value="0">请选择分类</option>
                        <c:forEach items="${categorysAll}" var="data" >
                            <option <c:if test="${update.cid == data.cid}">selected</c:if> value="${data.cid}">${data.cname}</option>
                        </c:forEach>
                    </select>
                    <div class="tips"></div>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label>作者：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" value="${update.author}" name="author" data-validate="required:请输入作者名称" />
                    <div class="tips"></div>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label>新书单价：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" value="${update.bprice}" name="bprice" data-validate="required:请输入单价" />
                    <div class="tips"></div>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label>库存：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" value="${update.bnum}" name="bnum" data-validate="required:请输入库存" />
                    <div class="tips"></div>
                </div>
            </div>


            <div class="form-group">
                <div class="label">
                    <label>出版日期：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" value="<fmt:formatDate value="${update.pubdate}" pattern="yyyy/MM/dd"/>" name="pubdate"/>
                    <div class="tips"></div>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label>出版社：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" value="${update.publisher}" name="publisher" data-validate="required:请输入出版社" />
                    <div class="tips"></div>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label>新书简介：</label>
                </div>
                <div class="field">
                    <textarea name="story" class="form-control" value="${update.story}"  placeholder="请填写简介...">${update.story}</textarea>
                    <div class="tips"></div>
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label>图片：</label>
                </div>
                <div class="field">
                    <input type="file" name="image" class="button bg-blue margin-left"   style="float:left;">
                </div>
            </div>

            <div class="field">
                <button class="button bg-main icon-check-square-o" type="submit">确认修改</button>
            </div>
        <strong class="text-red text-center">${updateError}</strong>
        </form>
        <script>
            $(function () {
                $("textarea").change(function () {
                    $("this").attr('value',$(this).val());
                });
            })
        </script>
    </div>
</div>

</body>
</html>
